<?php
highlight_string(file_get_contents("unserial4.php"));

class home{
    private $method;
    private $args;

    function __construct($method, $args){
        $this->method = $method;
        $this->args = $args;
    }

    function __destruct(){
        // TODO: Implement __destruct() method.
        if (in_array($this->method, array("ping"))) {
            call_user_func_array(array($this, $this->method), $this->args);
        }
    }

    function ping($host){
        // system("ping -C 2 $host");
        // for pretty output
        $output = [];
        exec("ping -C 2 $host", $output);
        foreach ($output as $line) {
            echo mb_convert_encoding($line."<br>", "UTF-8", "GBK");
        }
    }
    
    function __wakeup(){
        $this->args = array("127.0.0.1");
    }
}

$a=@$_GET["a"];
@unserialize($a);
?>
